{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ff89844e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1800001, 1800002, 1800003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "#元组 tuple\n",
    "网三_学号 = (1800001,1800002,1800003)\n",
    "print(网三_学号,type(网三_学号))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3227839b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1900001, 1900002, 1900003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "网二_学号 = 1900001,1900002,1900003\n",
    "print(网二_学号,type(网二_学号))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e80a29f3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1900001"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网二_学号 [0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a6d14adf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=11, tm_mday=1, tm_hour=18, tm_min=16, tm_sec=39, tm_wday=1, tm_yday=305, tm_isdst=0)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import time\n",
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "06a57601",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on struct_time object:\n",
      "\n",
      "class struct_time(builtins.tuple)\n",
      " |  struct_time(iterable=(), /)\n",
      " |  \n",
      " |  The time value as returned by gmtime(), localtime(), and strptime(), and\n",
      " |  accepted by asctime(), mktime() and strftime().  May be considered as a\n",
      " |  sequence of 9 integers.\n",
      " |  \n",
      " |  Note that several fields' values are not the same as those defined by\n",
      " |  the C language standard for struct tm.  For example, the value of the\n",
      " |  field tm_year is the actual year, not year - 1900.  See individual\n",
      " |  fields' descriptions for details.\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      struct_time\n",
      " |      builtins.tuple\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  tm_gmtoff\n",
      " |      offset from UTC in seconds\n",
      " |  \n",
      " |  tm_hour\n",
      " |      hours, range [0, 23]\n",
      " |  \n",
      " |  tm_isdst\n",
      " |      1 if summer time is in effect, 0 if not, and -1 if unknown\n",
      " |  \n",
      " |  tm_mday\n",
      " |      day of month, range [1, 31]\n",
      " |  \n",
      " |  tm_min\n",
      " |      minutes, range [0, 59]\n",
      " |  \n",
      " |  tm_mon\n",
      " |      month of year, range [1, 12]\n",
      " |  \n",
      " |  tm_sec\n",
      " |      seconds, range [0, 61])\n",
      " |  \n",
      " |  tm_wday\n",
      " |      day of week, range [0, 6], Monday is 0\n",
      " |  \n",
      " |  tm_yday\n",
      " |      day of year, range [1, 366]\n",
      " |  \n",
      " |  tm_year\n",
      " |      year, for example, 1993\n",
      " |  \n",
      " |  tm_zone\n",
      " |      abbreviation of timezone name\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  n_fields = 11\n",
      " |  \n",
      " |  n_sequence_fields = 9\n",
      " |  \n",
      " |  n_unnamed_fields = 0\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from builtins.tuple:\n",
      " |  \n",
      " |  __add__(self, value, /)\n",
      " |      Return self+value.\n",
      " |  \n",
      " |  __contains__(self, key, /)\n",
      " |      Return key in self.\n",
      " |  \n",
      " |  __eq__(self, value, /)\n",
      " |      Return self==value.\n",
      " |  \n",
      " |  __ge__(self, value, /)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __getitem__(self, key, /)\n",
      " |      Return self[key].\n",
      " |  \n",
      " |  __getnewargs__(self, /)\n",
      " |  \n",
      " |  __gt__(self, value, /)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __hash__(self, /)\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __iter__(self, /)\n",
      " |      Implement iter(self).\n",
      " |  \n",
      " |  __le__(self, value, /)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __len__(self, /)\n",
      " |      Return len(self).\n",
      " |  \n",
      " |  __lt__(self, value, /)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __mul__(self, value, /)\n",
      " |      Return self*value.\n",
      " |  \n",
      " |  __ne__(self, value, /)\n",
      " |      Return self!=value.\n",
      " |  \n",
      " |  __rmul__(self, value, /)\n",
      " |      Return value*self.\n",
      " |  \n",
      " |  count(self, value, /)\n",
      " |      Return number of occurrences of value.\n",
      " |  \n",
      " |  index(self, value, start=0, stop=9223372036854775807, /)\n",
      " |      Return first index of value.\n",
      " |      \n",
      " |      Raises ValueError if the value is not present.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from builtins.tuple:\n",
      " |  \n",
      " |  __class_getitem__(...) from builtins.type\n",
      " |      See PEP 585\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(time.localtime())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "01a47ee0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([1, 2, 3, 4], [3, 4, 5, 6]) <class 'tuple'>\n",
      "[1, 2, 3, 4] 1440074569280\n"
     ]
    }
   ],
   "source": [
    "tuple_test = ([1,2,3,4],[3,4,5,6])\n",
    "print(tuple_test,type(tuple_test)),id(tuple_test)\n",
    "print(tuple_test[0],id(tuple_test[0]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0e4d8ebf",
   "metadata": {},
   "outputs": [],
   "source": [
    "tuple_test[0].append(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "312931e1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([1, 2, 3, 4, 100], [3, 4, 5, 6]) <class 'tuple'>\n",
      "[1, 2, 3, 4, 100] 1440074569280\n"
     ]
    }
   ],
   "source": [
    "print(tuple_test,type(tuple_test)),id(tuple_test)\n",
    "print(tuple_test[0],id(tuple_test[0]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "71b94fe9",
   "metadata": {},
   "outputs": [],
   "source": [
    "#一般情况下，元组里面存放的是  常量(不可变)，数字、字符串即为变量\n",
    "#不存放变量：列表、字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1122d628",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n",
      "{'apple', 'orange', 'pear', 'banana'}\n"
     ]
    }
   ],
   "source": [
    "#集合sets\n",
    "#性质：无重复项，无序性\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "basket_lists = ['apple','orange','apple','pear','orange','banana']\n",
    "basket_sets = {'apple','orange','apple','pear','orange','banana'}\n",
    "print(basket_lists)\n",
    "print(basket_sets)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "715debcc",
   "metadata": {},
   "outputs": [],
   "source": [
    "舞蹈社 = {100,101,102,103}\n",
    "电竞社 = {107,108,109,100}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "2ba2c530",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{100}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社 & 电竞社"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "457f2841",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{100}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社.intersection(电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "feae9e9c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{100, 101, 102, 103, 107, 108, 109}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社 | 电竞社"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "71f9d6b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(舞蹈社 | 电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "89a7d821",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{100, 101, 102, 103, 107, 108, 109}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社.union(电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "7d62b126",
   "metadata": {},
   "outputs": [],
   "source": [
    "#字典dict\n",
    "#性质;无序性，keys是不可变的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "3c92c001",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新二班 = {\n",
    "    1800001:\"A\",\n",
    "    1800002:\"B\",\n",
    "    1800003:\"C\",\n",
    "    1800004:\"D\"\n",
    "    \n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "2779450e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1800001: 'A', 1800002: 'B', 1800003: 'C', 1800004: 'D'} <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "print(网新二班,type(网新二班))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "c9899a2a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1800001: 'A', 1800002: 'B', 1800003: 'C', 1800004: 'D'} <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "网新三班 = {\n",
    "    1800001:\"A\",\n",
    "    1800002:\"B\",\n",
    "    1800003:\"C\",\n",
    "    1800004:\"D\"\n",
    "    \n",
    "}\n",
    "print(网新三班,type(网新三班))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "c8520457",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#字典的取值；通过keys 进行字典的取值，unlike 列表、元组和字符串通过index取值\n",
    "网新三班[1800004]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "2f4b37e9",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新四班 = dict(\n",
    "    stu1800001=\"A\",\n",
    "    stu1800002=\"B\",\n",
    "    stu1800003=\"C\",\n",
    "    stu1800004=\"D\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "6a994675",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': 'A', 'stu1800002': 'B', 'stu1800003': 'C', 'stu1800004': 'D'}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新四班"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "92bc9a87",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新一班 = {}\n",
    "网新一班[\"stu1800001\"] = 'A'\n",
    "网新一班[\"stu1800002\"] = 'B'\n",
    "网新一班[\"stu1800003\"] = 'C'\n",
    "网新一班[\"stu1800004\"] = 'D'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "25fcda74",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': 'A', 'stu1800002': 'B', 'stu1800003': 'C', 'stu1800004': 'D'}"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新一班\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "4a1ee60f",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新一班_keys = [\"stu1800001\",\"stu1800002\",\"stu1800003\",\"stu1800004\"]\n",
    "网新一班_values = ['李一峰','Jack','Marry','周杰伦']\n",
    "网新一班 = {}\n",
    "for i in range(4):\n",
    "    网新一班[网新一班_keys[i]] = 网新一班_values[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "e98975af",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': '李一峰',\n",
       " 'stu1800002': 'Jack',\n",
       " 'stu1800003': 'Marry',\n",
       " 'stu1800004': '周杰伦'}"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新一班\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "22be1938",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
